package com.kisszoltan.android.passivity;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.GridView;

import com.kisszoltan.android.passivity.event.GridClickListener;
import com.kisszoltan.android.passivity.event.LearnButtonListener;
import com.kisszoltan.android.passivity.util.DBService;

public class CategoriesActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_categories);

        String[] categories = DBService.categoriesList(getApplicationContext());
        ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_multiple_choice, categories);

        final GridView gridView1 = (GridView) findViewById(R.id.gridView1);
        gridView1.setAdapter(adapter1);
        gridView1.setOnItemClickListener(new GridClickListener());

        Button learn = (Button) findViewById(R.id.button1);
        learn.setOnClickListener(new LearnButtonListener(gridView1));
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        return true;
    }

}
